package com.wyr.dao.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author wangyiren
 * @since 2025-03-07
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sys_user")
@Schema(name = "SysUser对象", description = "用户表")
public class SysUser implements Serializable {

    @Serial
    private static final long serialVersionUID=1L;

    @Schema(description = "用户ID")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;

    @Schema(description = "用户名")
    @TableField("username")
    private String username;

    @Schema(description = "密码")
    @TableField("password")
    private String password;

    @Schema(description = "所属部门")
    @TableField("dept_id")
    private Long deptId;

    @Schema(description = "所属部门名称")
    @TableField("dept_name")
    private String deptName;

    @Schema(description = "岗位组")
    @TableField("post_ids")
    private String postIds;

    @Schema(description = "头像")
    @TableField("icon")
    private String icon;

    @Schema(description = "邮箱")
    @TableField("email")
    private String email;

    @Schema(description = "手机号")
    @TableField("phone")
    private String phone;

    @Schema(description = "昵称")
    @TableField("nick_name")
    private String nickName;

    @Schema(description = "性别，0:男 1:女 2:未知")
    @TableField("sex")
    private String sex;

    @Schema(description = "备注信息")
    @TableField("note")
    private String note;

    @Schema(description = "启用状态，0:禁用 1:启用")
    @TableField("status")
    private String status;

    @Schema(description = "最后登录时间")
    @TableField("login_time")
    private Date loginTime;

    @Schema(description = "最后登陆IP")
    @TableField("login_ip")
    private String loginIp;

    @Schema(description = "创建时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    @Schema(description = "创建人")
    @TableField("create_by")
    private String createBy;

    @Schema(description = "修改时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @Schema(description = "修改人")
    @TableField("update_by")
    private String updateBy;

    @Schema(description = "有效状态，0:无效 1:有效")
    @TableField("valid")
    private Integer valid;

}
